import Vue from 'vue'
import VueRouter from "vue-router";
import Layout from '../views/layout.vue'
import ArticleDetail from '../views/article-detail.vue'
import Article from '../views/article.vue'
import collect from '../views/collect.vue'
import like from '../views/like.vue'
import user from '../views/user.vue'
Vue.use(VueRouter)

const router = new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/article'
    },
    {
      path: '/',//根路由
      component: Layout,
      //子路由前面不要加/
      children: [
        {
          path: 'article',
          component: Article
        },
        {
          path: 'collect',
          component: collect
        },
        {
          path: 'like',
          component: like
        },
        {
          path: 'user',
          component: user
        },
      ]
    },
    {
      path: '/ArticleDetail/:id',//根路由
      component: ArticleDetail
    }
  ]
})

export default router